<?php
//Knowledge Management Controller By Teerapong Singthong.
class Search extends Controller{
	function __construct(){
		parent::Controller();
	}
	
	function index(){
		$data["title"] = "Search - Knowledge Management.";
		$data["navigator"] = "&nbsp;&#8250;&nbsp;Search Node";

		//view
		$this->load->view('inc/search/mainpage',$data);	//load view one cols.
	}
	
	//query search
	
	function search_query(){
		$keyword = $this->input->post('keyword');
		$fields = $this->input->post('fields');
		
		//organization
		$major = $this->input->post('major');
		$date_choose = $this->input->post('date_choose');
		
		//generate case
		if(isset($keyword) && isset($fields)){
			//organization node
			if($fields==1){
				if(isset($date_choose)){
					$data["keyword"] = $keyword;
					$data["fields"] = $fields;	//not use
					$data["major"] = $major;
					$data["date_choose"] = $date_choose;
					
					$this->load->view('inc/search/result_of_organization',$data);
				}
				else if(!isset($date_choose)){
					$data["keyword"] = $keyword;
					$data["fields"] = $fields;
					$data["major"] = $major;
					//$data["date_choose"] = $date_choose;
					$this->load->view('inc/search/result_of_organization',$data);
				}
			}//end 1
		}
		
	}
	
	function organization_con(){
		$this->load->view('inc/search/organization');
	}
	
	function blog_con(){
		$this->load->view('inc/search/blog');
	}
	
}